package city.spring.modules.medicine.repository;

import city.spring.modules.medicine.entity.MedicineEntity;
import city.spring.modules.medicine.vo.MedicineVO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 存储库：药品信息
 *
 * @author 谢金婷
 * @date 2020-06-19 10:08:21
 */
@Repository
public interface MedicineRepository extends BaseMapper<MedicineEntity> {
    /**
     * 获取所有已入库药品
     *
     * @param page
     * @return
     */
    IPage<MedicineEntity> getMedicineIswarehousing(IPage<MedicineEntity> page, @Param(Constants.WRAPPER) Wrapper<MedicineEntity> wrapper);

    /**
     * 获取所有已入库药品,分页展示
     *
     * @param page
     * @return
     */
    IPage<MedicineEntity> getMedicineNowarehousing(IPage<MedicineEntity> page, @Param(Constants.WRAPPER) Wrapper<MedicineEntity> wrapper);

    /**
     * 获取所有的已入库药品信息，列表展示
     *
     * @return
     */
    List<MedicineEntity> getMedicineByIswarehousing();

    /**
     * 根据id获取药品信息
     */
    MedicineEntity getById(String id);

    /**
     * 根据货架id 获取该货架下的药品信息
     *
     * @param shelflevelId
     * @return
     */
    List<MedicineEntity> medicineByShelfId(String shelflevelId);

    /**
     * 根据基础信息查找药品信息
     *
     * @param name
     * @param category
     * @param specifications
     * @param unit
     * @param unitprice
     * @param dosageunit
     * @param supplierId
     * @param manufacturer
     * @param type
     * @param storehouseId
     * @param productiondate
     * @param expirationdate
     * @return
     */
    List<MedicineEntity> getByBaseMedicine(String name, String category, String specifications, String unit, BigDecimal unitprice, String dosageunit, String supplierId, String manufacturer, String type, String storehouseId, Date productiondate, Date expirationdate);

    IPage<MedicineVO> listPage(Page<? extends MedicineEntity> page, @Param(Constants.WRAPPER) Wrapper<? extends MedicineEntity> wrapper);

    IPage<MedicineVO> getMedicineIswarehousingPage(Page<? extends MedicineEntity> page, @Param(Constants.WRAPPER) Wrapper<? extends MedicineEntity> wrapper);
}